<?php
namespace app\frontend\controllers;

use app\models\User;

class IndexController extends ControllerBase
{
    public function afterExecuteRoute(\Phalcon\Mvc\Dispatcher $dispatcher)
    {
        $this->assets->getCss()->addCss('css/commonHeader.css');
        // 在找到的action后执行
        if ($dispatcher->getActionName() !== 'index') {

            $this->view->setTemplateAfter('index_after');
        }

        $route = $this->request->getQuery('route', 'string', '');
        $names = $this->request->getQuery('names', null, []);
        $values = $this->request->getQuery('values', null, []);

        if (!empty($names) && $route) {
            $route .= '?';
            foreach ($names as $key => $name) {
                $route .= $names[$key] . '=' . $values[$key];
            }
        }
        $this->view->setVar('route', $route);
    }

    public function indexAction()
    {
        $this->tag->setTitle('首页');
        $this->assets->getCss()->addCss('css/HomePage.css');
        $this->assets->getCss()->addCss('css/HomeAmend.css');
    }

    public function systemAction()
    {
        $this->tag->setTitle('系统设置');
    }

    public function carAction()
    {
        $this->tag->setTitle('车辆管理');
    }

    public function parameterAction()
    {
        $this->tag->setTitle('仪器台账');
    }

    public function ruleAction()
    {
        $this->tag->setTitle('制度管理');
    }

    public function memoAction()
    {
        $this->tag->setTitle('备忘录');
    }

    public function msnAction()
    {
        $this->tag->setTitle('通讯录');
    }

    public function attendanceAction()
    {
        $this->tag->setTitle('考勤管理');
    }
}

